<admintpl file="header" />
<style>
.form-horizontal .control-label{width:140px;padding-right:50px;}
.tip-a{
padding-left:10px;
margin-left:10px;background:#eaf3fe;width:80%;height:30px;line-height:30px;border:1px solid #3d92ea;
}
</style>
</head>
<body>
	<div class="wrap js-check-wrap">
		<div class="control-group tip-a">
		 如编辑活动元素，将替换全部默认元素。					
		</div>
		<form class="form-horizontal js-ajax-forms" action="admin.php?g=Admin&m=Yuansusys&a=editpost" method="post" enctype="multipart/form-data">
			<fieldset>
				<div class="tabbable">
					<div class="tab-content">
						<div class="tab-pane active" id="A">
							<fieldset>
							    <div class="control-group">
									<label class="control-label">活动ID：</label>
									<div class="controls">
										<span class="form-required" style="display:inline-block;padding-top:5px;">
										   {$thedata['id']}
										</span>
									</div>
								</div>
								<div class="control-group">
									<label class="control-label">活动名称：</label>
									<div class="controls">
										<span class="form-required" style="display:inline-block;padding-top:5px;">
										   {$thedata['name']}
										</span>
									</div>
								</div>					
								<div class="control-group">
									<label class="control-label">障碍物1：</label>
									<div>
									<input type="hidden" name="zai1" id="zai1" value="{$thedata['zaiArr'][0]}">
									<a href="javascript:upload_one_image('图片上传','#zai1');">
										<if condition="empty($thedata['zaiArr'][0])">
											<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="zai1-preview" width="135" style="cursor: hand"/>
										<else />
											<img src="{:sp_get_image_preview_url($thedata['zaiArr'][0])}" id="zai1-preview" width="135" style="cursor: hand; "/>
										</if>
									</a>
									<input type="button" class="btn btn-small" onclick="$('#zai1-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');
									$('#zai1').val('');return false;" value="取消图片">
								  建议尺寸：180*130px，以内，太宽太高，适配会有问题
								   </div>
								</div>
								<div class="control-group">
									<label class="control-label">障碍物1 - 碰撞文案：</label>
									<div class="controls">
										<span class="form-required" style="display:inline-block;padding-top:5px;">
										<input type="text" name="zta1" value="{$thedata['ztArr'][0]['a']}" placeholder=""> &nbsp:例子：不好，遇上消化问题！<br />
										<textarea name="ztb1" style="height:90px;">{$thedata['ztArr'][0]['b']}</textarea>
										 &nbsp:例子：宝宝娇嫩肠胃正处于发育期&lt;br /&gt;给宝宝选择合适口粮很重要&lt;br /&gt;避免出现消化不良，吸收不好等系列问题
										<br />
										<textarea name="ztc1" style="height:70px;">{$thedata['ztArr'][0]['c']}</textarea>
										&nbsp:例子：美赞臣亲舒&lt;br /&gt;微蛋白，低乳糖&lt;br /&gt;让宝宝舒适肠胃易消化
										<br />
										</span>
									</div>
								</div>
								
								<div class="control-group">
									<label class="control-label">障碍物2：</label>
									<div>
									<input type="hidden" name="zai2" id="zai2" value="{$thedata['zaiArr'][1]}">
									<a href="javascript:upload_one_image('图片上传','#zai2');">
										<if condition="empty($thedata['zaiArr'][1])">
											<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="zai2-preview" width="135" style="cursor: hand"/>
										<else />
											<img src="{:sp_get_image_preview_url($thedata['zaiArr'][1])}" id="zai2-preview" width="135" style="cursor: hand;"/>
										</if>
									</a>
									<input type="button" class="btn btn-small" onclick="$('#zai2-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');
									$('#zai2').val('');return false;" value="取消图片">
								  建议尺寸：180*130px，以内，太宽太高，适配会有问题
								   </div>
								</div>
								<div class="control-group">
									<label class="control-label">障碍物2 - 碰撞文案：</label>
									<div class="controls">
										<span class="form-required" style="display:inline-block;padding-top:5px;">
										<input type="text" name="zta2" value="{$thedata['ztArr'][1]['a']}" placeholder=""> &nbsp:<br />
										<textarea name="ztb2" style="height:90px;">{$thedata['ztArr'][1]['b']}</textarea>
										<br />
										<textarea name="ztc2" style="height:70px;">{$thedata['ztArr'][1]['c']}</textarea>
										<br />
										</span>
									</div>
								</div>
								
								<div class="control-group">
									<label class="control-label">障碍物3：</label>
									<div>
									<input type="hidden" name="zai3" id="zai3" value="{$thedata['zaiArr'][2]}">
									<a href="javascript:upload_one_image('图片上传','#zai3');">
										<if condition="empty($thedata['zaiArr'][2])">
											<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="zai3-preview" width="135" style="cursor: hand"/>
										<else />
											<img src="{:sp_get_image_preview_url($thedata['zaiArr'][2])}" id="zai3-preview" width="135" style="cursor: hand;"/>
										</if>
									</a>
									<input type="button" class="btn btn-small" onclick="$('#zai3-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');
									$('#zai3').val('');return false;" value="取消图片">
								  建议尺寸：180*130px，以内，太宽太高，适配会有问题
								   </div>
								</div>
								<div class="control-group">
									<label class="control-label">障碍物3 - 碰撞文案：</label>
									<div class="controls">
										<span class="form-required" style="display:inline-block;padding-top:5px;">
										<input type="text" name="zta3" value="{$thedata['ztArr'][2]['a']}" placeholder=""> &nbsp:<br />
										<textarea name="ztb3" style="height:90px;">{$thedata['ztArr'][2]['b']}</textarea>
										<br />
										<textarea name="ztc3" style="height:70px;">{$thedata['ztArr'][2]['c']}</textarea>
										<br />
										</span>
									</div>
								</div>
								
								<div class="control-group">
									<label class="control-label">障碍物4：</label>
									<div>
									<input type="hidden" name="zai4" id="zai4" value="{$thedata['zaiArr'][3]}">
									<a href="javascript:upload_one_image('图片上传','#zai4');">
										<if condition="empty($thedata['zaiArr'][3])">
											<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="zai4-preview" width="135" style="cursor: hand"/>
										<else />
											<img src="{:sp_get_image_preview_url($thedata['zaiArr'][3])}" id="zai4-preview" width="135" style="cursor: hand;"/>
										</if>
									</a>
									<input type="button" class="btn btn-small" onclick="$('#zai4-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');
									$('#zai4').val('');return false;" value="取消图片">
								  建议尺寸：180*130px，以内，太宽太高，适配会有问题
								   </div>
							   </div>
							   <div class="control-group">
									<label class="control-label">障碍物4 - 碰撞文案：</label>
									<div class="controls">
										<span class="form-required" style="display:inline-block;padding-top:5px;">
										<input type="text" name="zta4" value="{$thedata['ztArr'][3]['a']}" placeholder=""> &nbsp:<br />
										<textarea name="ztb4" style="height:90px;">{$thedata['ztArr'][3]['b']}</textarea>
										<br />
										<textarea name="ztc4" style="height:70px;">{$thedata['ztArr'][3]['c']}</textarea>
										<br />
										</span>
									</div>
								</div>
							   
							   <div class="control-group">
									<label class="control-label">障碍物5：</label>
									<div>
									<input type="hidden" name="zai5" id="zai5" value="{$thedata['zaiArr'][4]}">
									<a href="javascript:upload_one_image('图片上传','#zai5');">
										<if condition="empty($thedata['zaiArr'][4])">
											<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="zai5-preview" width="135" style="cursor: hand"/>
										<else />
											<img src="{:sp_get_image_preview_url($thedata['zaiArr'][4])}" id="zai5-preview" width="135" style="cursor: hand;"/>
										</if>
									</a>
									<input type="button" class="btn btn-small" onclick="$('#zai5-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');
									$('#zai5').val('');return false;" value="取消图片">
								  建议尺寸：180*130px，以内，太宽太高，适配会有问题
								   </div>
							   </div>
							   <div class="control-group">
									<label class="control-label">障碍物5 - 碰撞文案：</label>
									<div class="controls">
										<span class="form-required" style="display:inline-block;padding-top:5px;">
										<input type="text" name="zta5" value="{$thedata['ztArr'][4]['a']}" placeholder=""> &nbsp:<br />
										<textarea name="ztb5" style="height:90px;">{$thedata['ztArr'][4]['b']}</textarea>
										<br />
										<textarea name="ztc5" style="height:70px;">{$thedata['ztArr'][4]['c']}</textarea>
										<br />
										</span>
									</div>
								</div>
							   
							   <div class="control-group">
									<label class="control-label">障碍物6：</label>
									<div>
									<input type="hidden" name="zai6" id="zai6" value="{$thedata['zaiArr'][5]}">
									<a href="javascript:upload_one_image('图片上传','#zai6');">
										<if condition="empty($thedata['zaiArr'][5])">
											<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="zai6-preview" width="135" style="cursor: hand"/>
										<else />
											<img src="{:sp_get_image_preview_url($thedata['zaiArr'][5])}" id="zai6-preview" width="135" style="cursor: hand;"/>
										</if>
									</a>
									<input type="button" class="btn btn-small" onclick="$('#zai6-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');
									$('#zai6').val('');return false;" value="取消图片">
								  建议尺寸：180*130px，以内，太宽太高，适配会有问题
								   </div>
							   </div>
							   <div class="control-group">
									<label class="control-label">障碍物6 - 碰撞文案：</label>
									<div class="controls">
										<span class="form-required" style="display:inline-block;padding-top:5px;">
										<input type="text" name="zta6" value="{$thedata['ztArr'][5]['a']}" placeholder=""> &nbsp:<br />
										<textarea name="ztb6" style="height:90px;">{$thedata['ztArr'][5]['b']}</textarea>
										<br />
										<textarea name="ztc6" style="height:70px;">{$thedata['ztArr'][5]['c']}</textarea>
										<br />
										</span>
									</div>
								</div>
							   
							   
							   <div class="control-group">
									<label class="control-label">障碍物7：</label>
									<div>
									<input type="hidden" name="zai7" id="zai7" value="{$thedata['zaiArr'][6]}">
									<a href="javascript:upload_one_image('图片上传','#zai7');">
										<if condition="empty($thedata['zaiArr'][6])">
											<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="zai7-preview" width="135" style="cursor: hand"/>
										<else />
											<img src="{:sp_get_image_preview_url($thedata['zaiArr'][6])}" id="zai7-preview" width="135" style="cursor: hand;"/>
										</if>
									</a>
									<input type="button" class="btn btn-small" onclick="$('#zai7-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');
									$('#zai7').val('');return false;" value="取消图片">
								  建议尺寸：180*130px，以内，太宽太高，适配会有问题
								   </div>
							   </div>
							   <div class="control-group">
									<label class="control-label">障碍物7 - 碰撞文案：</label>
									<div class="controls">
										<span class="form-required" style="display:inline-block;padding-top:5px;">
										<input type="text" name="zta7" value="{$thedata['ztArr'][6]['a']}" placeholder=""> &nbsp:<br />
										<textarea name="ztb7" style="height:90px;">{$thedata['ztArr'][6]['b']}</textarea>
										<br />
										<textarea name="ztc7" style="height:70px;">{$thedata['ztArr'][6]['c']}</textarea>
										<br />
										</span>
									</div>
								</div>
							   
							   <div class="control-group">
									<label class="control-label">障碍物8：</label>
									<div>
									<input type="hidden" name="zai8" id="zai8" value="{$thedata['zaiArr'][7]}">
									<a href="javascript:upload_one_image('图片上传','#zai8');">
										<if condition="empty($thedata['zaiArr'][7])">
											<img src="__TMPL__Public/assets/images/default-thumbnail.png" id="zai8-preview" width="135" style="cursor: hand"/>
										<else />
											<img src="{:sp_get_image_preview_url($thedata['zaiArr'][7])}" id="zai8-preview" width="135" style="cursor: hand;"/>
										</if>
									</a>
									<input type="button" class="btn btn-small" onclick="$('#zai8-preview').attr('src','__TMPL__Public/assets/images/default-thumbnail.png');
									$('#zai8').val('');return false;" value="取消图片">
								  建议尺寸：180*130px，以内，太宽太高，适配会有问题
								   </div>
							   </div>
							   <div class="control-group">
									<label class="control-label">障碍物8 - 碰撞文案：</label>
									<div class="controls">
										<span class="form-required" style="display:inline-block;padding-top:5px;">
										<input type="text" name="zta8" value="{$thedata['ztArr'][7]['a']}" placeholder=""> &nbsp:<br />
										<textarea name="ztb8" style="height:90px;">{$thedata['ztArr'][7]['b']}</textarea>
										<br />
										<textarea name="ztc8" style="height:70px;">{$thedata['ztArr'][7]['c']}</textarea>
										<br />
										</span>
									</div>
								</div>
							   
							   
								
								
							</fieldset>
						</div>
						 
						 
					</div>
				</div>

				<div class="form-actions">
				    <input type="hidden" name="option_id" value="{$thedata['id']}">
					<button type="submit" class="btn btn-primary  js-ajax-submit">保存</button>
				</div>
			</fieldset>
		</form>

	</div>
	<script type="text/javascript" src="public/js/common.js"></script>
    <script>
		/////---------------------
		$(function(){
			$("#js-site-admin-url-password").change(function(){
				$(this).data("changed",true);
			});
		});
		Wind.use('validate', 'ajaxForm', 'artDialog', function() {
			//javascript
			var form = $('form.js-ajax-forms');
			//ie处理placeholder提交问题
			if ($.browser && $.browser.msie) {
				form.find('[placeholder]').each(function() {
					var input = $(this);
					if (input.val() == input.attr('placeholder')) {
						input.val('');
					}
				});
			}
			//表单验证开始
			form.validate({
				//是否在获取焦点时验证
				onfocusout : false,
				//是否在敲击键盘时验证
				onkeyup : false,
				//当鼠标掉级时验证
				onclick : false,
				//验证错误
				showErrors : function(errorMap, errorArr) {
					//errorMap {'name':'错误信息'}
					//errorArr [{'message':'错误信息',element:({})}]
					try {
						$(errorArr[0].element).focus();
						art.dialog({
							id : 'error',
							icon : 'error',
							lock : true,
							fixed : true,
							background : "#CCCCCC",
							opacity : 0,
							content : errorArr[0].message,
							cancelVal : "确定",
							cancel : function() {
								$(errorArr[0].element).focus();
							}
						});
					} catch (err) {
					}
				},
				//验证规则
				rules : {
					'doorplate' : {
						required : 1
					}
				},
				//验证未通过提示消息
				messages : {
					'doorplate' : {
						required : "请输入店名！"
					}
				},
				//给未通过验证的元素加效果,闪烁等
				highlight : false,
				//是否在获取焦点时验证
				onfocusout : false,
				//验证通过，提交表单
				submitHandler : function(forms) {
					$(forms).ajaxSubmit({
						url : form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
						dataType : 'json',
						beforeSubmit : function(arr, $form, options) {

						},
						success : function(data, statusText, xhr, $form) {
							if (data.status) {
								setCookie("refersh_time", 1);
								var _url='admin.php?g=Admin&m=Yuansusys&a=index&p={$p}';
								redirect(_url);
								return true;
								
							} else {
								alert(data.info);
							}
						}
					});
				}
			});
		});
		////-------------------------
		
		
	</script>
</body>
</html>	